#!/bin/usr/python

#
# Touches a lock file in order to tickle the build system into action.
#
import os
from time import time

# Replace path with something sensible
path = "/home/henrik/projects/proj/acreo/build.me"

# Throws OSError if the file cannot be created
def touch(path):
    fd = os.open(path, os.O_CREAT | os.O_WRONLY)
    st = os.fstat(fd)
    t = (st.st_atime, time())
    os.utime(path, t)
    os.close(fd)
    
def main():
    try:
        touch(path)
        print("OK")
    except OSError:
        print("Failed to create lock")

if __name__ == '__main__':
    main()
